<?php
	class Config{
		/**
		@class Config

		Différente variable globale
		*/
		/* DB */
		public static $type = "MySql";
		public static $host = "localhost";
		public static $user = "root";
		public static $pass = "";
		public static $dbas = "pair";

		/* PAGES */
		public static $varPage = "p";
		public static $defaultPage = "home";
		public static $errorPage = "error";
		public static $pathPage = "./pages/";

		/* DEBUG */
		public static $gdebug = true;

		public static $debugPage = false;
		public static $debugQuery = false;
		public static $debugRows = false;
		public static $debugProject = false;

		public static $rew = false;

		static function d($text){
			if(Config::$gdebug)
				Eden("debug")->output($text);
		}

		static function verif($array,$index=NULL,$type="string",$isEqual=null){
			if($index){
				if(isset($array[$index]) && !empty($array[$index])){
					if($isEqual){
						if(Config::protectVar($array[$index],$type) == $isEqual)
							return Config::protectVar($array[$index],$type);
						else
							return null;
					}else{
						return Config::protectVar($array[$index],$type);
					}
				}else{
					return null;
				}
			}else{
				if(isset($array) && !empty($array)){
					if($isEqual){
						if(Config::protectVar($array,$type) == $isEqual)
							return Config::protectVar($array,$type);
						else
							return null;
					}else{
						return Config::protectVar($array,$type);
					}
				}else{
					return null;
				}
			}
		}

		static function protectVar($var,$type){
			switch($type){
				case "string":
					return htmlentities($var);
				break;

				case "int":
					return intval($var);
				break;

				case "email":
					return $var;
				break;

				default:
					return htmlentities($var);
				break;
			}
			return null;
		}

	}
?>